﻿/*
 * KLF Headless Browser
 * Written by Kris Oye <kristianoye@gmail.com>
 * Copyright (C) 2011-2012.  All rights reserved.
 */
namespace KLF.Lib.Browser.JavaScriptHelpers
{
    #region Using Statements

    using System;

    #endregion

    public class Location
    {
        private Uri Uri;

        public Location(Uri u)
        {
            Uri = u;
        }

        public string host
        {
            get
            {
                return (Uri.Port != 80 ? String.Format("{0}:{1}", Uri.Host, Uri.Port) : Uri.Host);
            }
        }

        public string hostname
        {
            get { return Uri.Host; }
        }

        public string href
        {
            get
            {
                return Uri.AbsoluteUri;
            }
        }

        public string pathname
        {
            get
            {
                return Uri.LocalPath;
            }
        }

        public int port
        {
            get
            {
                return Uri.Port;
            }
        }

        public string protocol
        {
            get
            {
                return Uri.Scheme;
            }
        }

        public string search
        {
            get
            {
                return Uri.Query;
            }
        }

        public void assign(string url)
        {
        }

        public void reload()
        {
        }

        public void replace(string url)
        {
        }
    }
}
